//
// Created by win10 on 2024/12/11.
//
#include<stdio.h>
int Bsearch(int *a, int n, int k, int *p) {
    int low = 0, high = n - 1;
    *p = 0;//需要进行初始化
    while (low <= high) {
        int mid = (low + high) / 2;
        (*p)++;
        if (a[mid] == k) return mid;
        if (a[mid] < k) low = mid + 1;
        else high = mid - 1;
    }
    return -1;
}
int main(){
    int n,cmp,*p=&cmp;
    int pos,num=0;
    int low=0,high,mid,k;
    while(~scanf("%d",&n))
    {
        int a[n];
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        scanf("%d",&k);
        int pos=Bsearch(a,n,k,p);
        printf("%d\n%d\n",pos,cmp);
    }
    return 0;
}
/* 请在这里填写答案 */